﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BHan.Migrations
{
    /// <inheritdoc />
    public partial class init_menutable : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "sys_menu",
                columns: table => new
                {
                    menuId = table.Column<int>(type: "int", nullable: false, comment: "菜单id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    menuName = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "菜单名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    pMenuId = table.Column<int>(type: "int", nullable: true, comment: "父级菜单"),
                    orderNum = table.Column<int>(type: "int", nullable: true, comment: "菜单排序顺序"),
                    path = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "地址（窗体Name）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    icon = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "图标")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    menuType = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: false, comment: "菜单类型 C=目录 M=菜单 B=按钮")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    status = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "状态(false 正常，true 禁用)"),
                    delFlag = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "逻辑删除"),
                    remark = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_menu", x => x.menuId);
                },
                comment: "系统的菜单管理表")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "sys_menu");
        }
    }
}
